import { any } from 'prop-types';
import http from '../utils/axios';  //引进http
// 基础路径
const baseUrl = 'http://dsq.ljc.icu:8080'



interface Type {
    userId: number;
    userName: string;
    userAccount: string;
    userPhone: number;
    regTime: string;
    userBuyMoney: number;
    status: boolean;
}

// 获取用户列表数据
export const getUserList = ()=>{
    return http.get<Type[]>(baseUrl+'/user/queryAll')
}


// 根据id获取户用详情数据 传参
interface DataType{
    code:string,
    data:{},
    msg:string
}
export const getSearch = (params:{})=>{
    return http.get<DataType>(baseUrl+'/user/queryMsg',params)
}




// 筛选查询接口
export const FilterQuery = (data:any)=>{
    return http.post<any>(baseUrl+'/user/queryCondition',data)
}



// 删除接口
interface DelMsg {
    userId:number
}
export const userDelete = (data:any) => 
http.post<any>(baseUrl+'/user/deleteUser', data); 



//修改
// export const amendUser = (data:any) => 
// http.post<any>(baseUrl+'/user/updateUser', data);


// export const amendUser = (data:{userId:number,
//     userName: string,
//     userPhone: string}) => 
// http.post<any>(baseUrl+'/user/updateUser', data);

export const amendUser = (data:any) =>(http.post<any>(baseUrl+'/user/updateUser',data))

//排序
    // 时间顺序
    export const timeOrder = (params?:any)=>
     http.get<any>(baseUrl+'/user/regTimeAsc',params)
// 时间倒序
     export const timeinverted = (params?:any)=>
     http.get<any>(baseUrl+'/user/regTimeDesc',params)
// 金额顺序
     export const moneyOrder = (params?:any)=>
     http.get<any>(baseUrl+'/user/moneyAsc',params)
// 金额倒序
     export const moneyinverted= (params?:any)=>
     http.get<any>(baseUrl+'/user/moneyDesc',params)

